cmake_minimum_required(VERSION 3.1.3)
project(sg805_driver)


# C++ 11
set(CMAKE_CXX_STANDARD 11)


## 需要生成消息，即自定义数据结构
find_package(catkin REQUIRED COMPONENTS
  message_generation            
  actionlib
  control_msgs
  joint_state_publisher
  robot_state_publisher
  roscpp
  sensor_msgs
  std_msgs
  tf
  geometry_msgs
)

## 将msg文件夹中的文件进行转换生成ROS C++头文件
add_message_files(FILES
  ExtraFeatures.msg
  FastPoint.msg
)

## 将srv文件夹中的文件进行转换生成ROS C++头文件
add_service_files(FILES
  getDistance.srv
)


## 生成ROS C++头文件的消息，将其以来的其他消息结构放置在此处
generate_messages(DEPENDENCIES
  std_msgs
)

catkin_package(
  CATKIN_DEPENDS
  message_runtime
)


# 头文件引入
include_directories(
  include include/sg805_driver
  ${catkin_INCLUDE_DIRS}
)


# ROS
add_executable(sg805_main
  include/sg805_driver/common.h
  include/sg805_driver/SG805Robot.h
  include/sg805_driver/SG805RobotRos.h
  #include/sg805_driver/AllBlueEncoder.h
  include/sg805_driver/SG805Servo.h
  src/common.cpp
  src/SG805Robot.cpp
  src/SG805RobotRos.cpp
  #src/AllBlueEncoder.cpp
  src/SG805Servo.cpp
  src/sg805_main.cpp
)
add_dependencies(sg805_main ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(sg805_main
  ${catkin_LIBRARIES} -lpthread
)


# POSE
add_executable(sg805_pose_publisher
  src/sg805_pose_publisher.cpp
)
add_dependencies(sg805_pose_publisher ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(sg805_pose_publisher
  ${catkin_LIBRARIES}
)
